package com.ssy.lingxi.marketing.model.constant;

import java.util.Arrays;

/**
 * 每次砍价类型：1-随机金额 2-固定金额
 * @author yzc
 * @version 2.0.0
 * @date 2021/10/29
 */
public enum BargainTypeEnum {

    RANDOM(1, "随机金额"),
    RESTRICT(2, "固定金额"),
    ;

    private final Integer code;
    private final String message;

    BargainTypeEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public static String getMessage(Integer code) {
        return Arrays.stream(BargainTypeEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().map(BargainTypeEnum::getMessage).orElse("");
    }


}
